
<#include "header.ftl">
  <!-- 内容区域 -->
<div class="tpl-content-wrapper">

   <div class="container-fluid am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                        
                    </div>
                    <div class="am-u-lg-3 tpl-index-settings-button">
                        <a href="#"><button type="button" class="page-header-button"><span class="am-icon-reply-all"></span> 返回</button></a>
                    </div>
                </div>
</div>
  <div class="row-content am-cf">
  
  

          <div class="row">

                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">${survey.name}</div>
                                
                            </div>
                            <div class="widget-body am-fr">

                                <form class="am-form tpl-form-line-form"  method="post" action="${Domain}api/access/death" id="iask" >
                                   <input type="hidden" id="usetime" name="usetime" value="">
                                  <input type="hidden" id="access" name="access" value="${access.id}">
                                   
                               
                                     <div class="am-form-group">
                                    	  患者：${patient.name}  (${patient.SimpleNo()})
                                        
                                    </div>
                                    <div class="am-form-group">
                                    	  性别：${patient.gender} &nbsp;&nbsp;&nbsp;&nbsp; 年龄 ${patient.Age()}
                                    </div>
                                    <hr>
                          			<div class="am-form-group">
                                                                                                        死亡记录 <span class="am-fr"><i id="usetimeshow">0</i>秒 </span>                                       
                                    </div>
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-form-label">亡故时间 </label>
                                        <div class="am-u-sm-9">
                                            <input type="text" class="tpl-form-input" id="deathstamp" name="deathstamp" class="am-form-field" placeholder="死亡日期" data-am-datepicker readonly required/>                                             
                                        </div>
                                    </div>
                                     <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-form-label">亡故原因 </label>
                                        <div class="am-u-sm-9">
                                            <label class="am-radio-inline">
										    <input type="radio" name="cause" value="0" data-am-ucheck> 未知
										  </label>
										  <label class="am-radio-inline">
										    <input type="radio" name="cause" value="1" data-am-ucheck> 死于疾病
										  </label>
										  <label class="am-radio-inline">
										    <input type="radio" name="cause" value="2" data-am-ucheck> 自然死亡
										  </label> 
										  <label class="am-radio-inline">
										    <input type="radio" name="cause" value="3" data-am-ucheck> 外意伤亡
										  </label>                                   
                                        </div>
                                    </div>
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-form-label">死亡地点 </label>
                                        <div class="am-u-sm-9">
                                            <label class="am-radio-inline">
										    <input type="radio" name="deathplace" value="0" data-am-ucheck> 不详
										  </label>
										  <label class="am-radio-inline">
										    <input type="radio" name="deathplace" value="1" data-am-ucheck> 医院 
										  </label>
										  <label class="am-radio-inline">
										    <input type="radio" name="deathplace" value="2" data-am-ucheck> 家中
										  </label> 
										  <label class="am-radio-inline">
										    <input type="radio" name="deathplace" value="3" data-am-ucheck> 外出 
										  </label>                                   
                                        </div>
                                    </div>
                                    <div class="am-form-group">
                                        <label  class="am-u-sm-3 am-form-label">死亡备注</label>
                                        <div class="am-u-sm-9">
                                            <textarea class="" rows="3" id="description" name="description" placeholder="可以不填"></textarea>
                                        </div>
                                    </div>
                                    <div class="am-form-group">
                                    <label  class="am-u-sm-3 am-form-label"></label>
                                        <div class="am-u-sm-9">
                                            <button type="submit" id="sub" class="am-btn page-header-button tpl-btn-bg-color-success am-btn-block">确认</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
        
         
        
            
   </div>
</div>        
<script type="text/javascript" src="${Domain}common/js/jquery.form.min.js"></script> 
<script type="text/javascript">
  var loading; 
  var usetime=0;
  var int;//定时器
//设置时间
function settime()
{
    usetime=usetime+1;
   $("#usetime").val(usetime*1000)
    $("#usetimeshow").text(usetime)
}
$(function() {
  int=setInterval("settime()",1000) ;
  
  $('#iask').validator({
    onValid: function(validity) {   
      $(validity.field).closest('.am-form-group').find('.am-alert').hide();
    },
    onInValid: function(validity) {
   
      var $field = $(validity.field);
      var $group = $field.closest('.am-form-group');
      var $tpl = $group.find('.tpl-form-input');
      var $alert = $group.find('.am-alert');
      // 使用自定义的提示信息 或 插件内置的提示信息
      var msg = $tpl.data('validationMessage') || this.getValidationMessage(validity);
      if (!$alert.length) {
        $alert = $('<div class="am-alert am-alert-danger"></div>').hide().
          insertAfter($tpl);
      }

      $alert.html(msg).show();
    }
  });
});
  
  
   $('#iask').ajaxForm({
	    beforeSubmit: function(a,f,o) {
	     if($("#deathstamp").val()=="")return;
	        loading=weui.loading('数据加载中...');
	    },
	    success: function(json) {	    	
	    	if(json.status)
	    	{
	    	  	if(loading)loading.hide();
	    		weui.toast(json.msg); 
	    		location.href="${Domain}my/access/ask/${access.id}";	
	    		
	    	}else
	    	{	
	    		if(loading)loading.hide();
	    	    weui.alert(json.msg);  		 
	    	}
	    }
	});
	</script>
<#include "footer.ftl">